import java.lang.reflect.Array;

public class Test {
    public static void main(String[] args) {
       double sum = 0.0;
       int flg = 1;
        for (int i = 1; i <= 100; i++) {
            sum += 1.0 / i*flg;
            flg = -flg;
        }
        System.out.println(sum);
    }





    public static void main2(String[] args) {
        //二分查找
        int [] array = {1,8,5,4,6,4,7};
        int key = 7;
        int ret = biranySearch(array,key);
        System.out.println(ret);
    }
    public static int biranySearch(int [] array,int key){
        int left = 0;
        int right = array.length-1;
        while(left<=right){
            int m = (left+right)/2;
            if(array[m]<key){
                left = m+1;
            }else if(array[m]>key){
                right = m-1;
            }else {
                return m;
            }
        }
        return -1;
    }
    public static void main1(String[] args) {
        int [] array = {1,2,3,4,5,6};
        String ret = mytoString(array);
        System.out.println(ret);
    }
    public static String mytoString(int [] array){
        if(array==null){
            return null;
        }
        String ret = "[";
        for(int i=0;i< array.length;i++){
            ret+=array[i];
            if(array.length-1!=i){
                ret+=",";
            }
        }
        ret += "]";
        return ret;
    }
}
